package com.cyj.dream.core.util.codec;

import java.util.Base64;

/**
 * @Description: 以及通用的base64
 * @BelongsProject: DreamChardonnay
 * @BelongsPackage: com.cyj.dream.core.util.codec
 * @Author: ChenYongJia
 * @CreateTime: 2021-09-26 13:32
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
public class Base64Utils {

    public static final Base64.Encoder encoder = Base64.getEncoder();
    public static final Base64.Decoder decoder = Base64.getDecoder();

    /**
     * base64加密
     *
     * @param encodeText 明文
     * @return byte[]
     * @date 2021/6/4 11:51
     * @author ChenYongJia
     * @version 1.0
     */
    public static byte[] encoder(byte[] encodeText) {
        return encoder.encode(encodeText);
    }

    /**
     * base64加密
     *
     * @param decodeText 密文
     * @return byte[]
     * @date 2021/6/4 11:51
     * @author ChenYongJia
     * @version 1.0
     */
    public static byte[] decoder(byte[] decodeText) {
        return decoder.decode(decodeText);
    }

}
